﻿#ifndef MAINWINDOW_H
#define MAINWINDOW_H

#include <QMainWindow>
#include "udpsender.h"
#include "udpreceiver.h"

QT_BEGIN_NAMESPACE
namespace Ui { class MainWindow; }
QT_END_NAMESPACE

class MainWindow : public QMainWindow
{
    Q_OBJECT

public:
    MainWindow(QWidget *parent = nullptr);
    ~MainWindow();
    void sendMsg();

private:
    Ui::MainWindow *ui;
    UdpSender udp_sender;
    UdpReceiver udp_receiver;

    QJsonObject send_json_object;
    QJsonObject nav_object;
    QJsonObject actionObject;

    bool is_connected;

    void clickConnectButton();
    void connected();
    void disconnected();

    void chooseStandbyMode();
    void chooseNavigationMode();
    void chooseManualMode();

    void clickSendButton();
    void navigationJson();

    void clickControlButton(int control_id);  // 1 resume, 2 pause, 3 end

    void updataTreeWidget(QJsonObject data);

    void clickActionButton();
    void setArg(int x);

};
#endif // MAINWINDOW_H
